package networking.messages.playerMessages;

import com.jme.math.Vector3f;

import networking.messages.ProximityMessage;

public class PlayerUpdateMessage extends PlayerMessage implements ProximityMessage {
	
	private int value;
	private PlayerUpdateValueType type;
	private Vector3f loc;
	
	public PlayerUpdateMessage() {
		super();
	}
	
	public PlayerUpdateMessage(int playerIndex, int value, PlayerUpdateValueType type) {
		this(playerIndex, value, type, null);
	}
	
	public PlayerUpdateMessage(int playerIndex, int value, PlayerUpdateValueType type, Vector3f loc) {
		super(playerIndex);
		this.value = value;
		this.type = type;
		this.loc = loc;
	}
	
	public int getValue() { return value; }
	
	public PlayerUpdateValueType getType() { return type; }
	
	@Override
	public boolean applies() {
		return loc != null && type == PlayerUpdateValueType.Money;
	}
	
	@Override
	public Vector3f getLocation() {
		return loc;
	}
}